<template>
    <section class="server-register">
    	<div class="page1" v-show="page===1">
  			<form-common 
  				@add="add" 
  				@search = "search"
  				:formLabel="formLabel" 
  				:formInline="formInline"
  			></form-common>
  			<table-common @detail="detail" @edit="edit" @pushServer="pushServer"  :tableLabel="tableLabel" :tableData="tableData" :currentType="currentType"></table-common>
    	</div>
    	
    	<div class="page2" v-show="page===2">
    		<server-register-form @goBack="goBack" :treeSeach="treeSeach"></server-register-form>
    	</div>
    	
    	 <div class="page3 page2" v-show="page===3">
    		<server-push-form :id="id" @goBack="goBack" :treeSeach="treeSeach"></server-push-form>
    	</div>
    		<!--<el-dialog
				  title="提示"
				  :visible.sync="dialog1Visible"
				  width="30%"
				  >
			</el-dialog>-->
    </section>
</template>

<script>
	import formCommon from "../common/formCommon"
	import serverRegisterForm from "./serverRegisterForm"
	import serverPushForm from "../common/serverPushForm"
	import tableCommon from "../common/tableCommon"
	import {componentGetYwType,componentSearchYwType} from "../common/js_css_img/serverResourceComputed"
    export default {
    	components:{
    		formCommon,
    		tableCommon,
    		serverRegisterForm,
    		serverPushForm
    	},
        data() {
          return {
          	id:0,
          	currentType:'serverRegister',
          	page:1,
          	dialog1Visible:false,
          	formInline:{
          		type:'',
          		myInput:"",
          	},
          	formLabel:[
          		{
          			type:'button',
          			placeholder:'新增',
          			label:'',
          			float:"left",
          			method:'add'
          		},
          		{
          			type:'button',
          			placeholder:'搜索',
          			label:'',
          			float:"right",
          			method:'search'
          		},
          		{
          			type:'input',
          			placeholder:'请输入开发商名称、联系',
          			label:'',
          			model:'name',
          			float:"right",
          		},
          		{
          			type:'select',
          			placeholder:'请选择',
          			label:'业务分类 ：',
          			float:"right",
          			model:'businessTypeIds',
          			options:[],
          		},
          	],
          	tableLabel:{
          		resocureName:"资源名称",
          		serverName:'服务方名称',
          		serverType:'业务类型',
          		createrData:'创建时间',
          	},
          	tableData:[],
          	treeSeach:{
          		segment:[],/*网段类型*/
          		info_type:[],/*信息类型*/
          		business_type:[],/*业务类型*/
          	}
          };
        },
        methods: {
        	onSubmit(){
        		
        	},
        	add(){/*新增*/
        		this.page=2;
        	},
        	search(val){/*搜索*/
        		console.log(val);
        		componentSearchYwType(this,val);
        	},
        	edit(){
        	},
        	detail(){
        	},
        	goBack(){
        		this.page=1;
        	},
        	pushServer(scope){
        		console.log(scope);
        		this.id = scope.row.id;
        		this.page=3;
        	},
        	getYwType(){/*获取三种类型的数据*/
        		componentGetYwType(this,'');
        	}
        },
        mounted(){
        	this.getYwType();/*获取业务类型*/
        	this.search({})/*获取列表数据*/
        }
  };
</script>

<style scoped="scoped">
    .page2{
    	width: 850px;
    }
</style>